package logic

import (
	"context"

	"go-weixin/app/music/musicrpc/internal/svc"
	"go-weixin/app/music/musicrpc/pb/proto/music"
	"go-weixin/common/utils"

	"github.com/zeromicro/go-zero/core/logx"
)

type MusicAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
	ut utils.Utils
}

func NewMusicAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MusicAddLogic {
	return &MusicAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
		ut:     *utils.UT,
	}
}

func (l *MusicAddLogic) MusicAdd(in *music.MusicAddReq) (*music.MusicAddResp, error) {
	_, err := l.ut.GoFastDfs.GoFastDfsClient(in.FileByte, in.Filename, in.Size, l.svcCtx.Config.GoFast.DNS)
	if err != nil {
		return nil, err
	}
	return &music.MusicAddResp{}, nil
}
